
/////////////////////////////////////////////////////////
//	File Name : "CGame.h"
//	Author Name : ZombieHead
//	Purpose : To contain all game related code
/////////////////////////////////////////////////////////

#ifndef _CGAME
#define _CGAME

#include "stdafx.h"
// SGD Singletons
#include "SGD Wrappers\CSGD_Direct3D.h"
#include "SGD Wrappers\CSGD_TextureManager.h"
#include "SGD Wrappers\CSGD_FModManager.h"
#include "SGD Wrappers\CSGD_DirectInput.h"

#include "IGameState.h"
#include "CStopWatch.h"
#include "CAnimationManager.h"
class CGame
{
private:

	// Singleton Pointers
	CSGD_Direct3D*			m_pD3D;
	CSGD_TextureManager*	m_pTM;
	CSGD_FModManager*		m_pFM;
	CSGD_DirectInput*		m_pDI;
	//CProfileManager*		m_pPM;
	CAnimationManager*		m_pAM;
	HWND					m_hWnd;
	RECT					m_RenderRect;
	//Game State
	vector<IGameState*>		m_pGameState;
	IGameState*				m_pCurrState;

	//Screen stuffs
	int						m_ScreenWidth;
	int						m_ScreenHeight;
	int						m_nBrightness;
	bool					m_bFullScreen;

	//sound stuff
	float					m_fSfxVol; 
	float					m_fBGM;
	float					m_fPan;

	float					m_fElapsedTime;
	bool					m_bGamePad;
	//CLevel*					m_pCurrentLevel;
	int						m_nScore;

	//Change Objects
	int m_nWaterLockObJ;
	int m_nLoadingLockObj;

	//Timer
	CStopWatch m_StopWatch;

	CGame();
	~CGame();
	CGame(const CGame& game);
	CGame& operator =(const CGame& game);

	// Utility functions
	bool Input();
	void Update(float fElapsedTime);
	void Render();

public:
	static CGame* GetInstance();

	// Initialization
	void Initialize(HWND hWnd, HINSTANCE hInstance, int nScreenWidth, int nScreenHeight, bool bIsWindowed,bool IsArcade);
	// SetState
	void ChangeState(IGameState* state);
	void AddState(IGameState* state);
	void RemoveStateLastState();
	void ClearAllStates();
	// Execution
	bool Main(); // returns false when game should quit
	// Clean Up
	void Shutdown();	
	void LoadData();

	bool IsLastState();
	
	int GetWaterObj(){return m_nWaterLockObJ;}
	int GetLoadingObj(){return m_nLoadingLockObj;}

	//Accessors
	HWND GethWnd()		 { return m_hWnd;}
	int GetScreenWidth() { return m_ScreenWidth;}
	int GetScreenHeight(){ return m_ScreenHeight;}
	int GetBrightness() {return m_nBrightness;}
	bool GetFullScreen() {return m_bFullScreen;}
	CSGD_Direct3D* GetDirect3D() {return m_pD3D;}
	CSGD_TextureManager* GetTextureManager() {return m_pTM;}
	CSGD_FModManager* GetFMOD() {return m_pFM;}
	CSGD_DirectInput* GetDirectInput() {return m_pDI;}
	vector<IGameState*> GetGameStates() {return m_pGameState;}
	IGameState* GetCurrentState() {return m_pCurrState;}
	float GetSFXVolume() {return m_fSfxVol;}
	float GetBGMVolume() {return m_fBGM;}
	float GetPanning() {return m_fPan;}
	float GetElapsedTime() {return m_fElapsedTime;}
	bool GetGamePad() {return m_bGamePad;}
	//CLevel* GetLevel() {return m_pCurrentLevel;}
	int GetScore() {return m_nScore;}
	//Mutators
	void SetScreenWidth(int width) { m_ScreenWidth = width;}
	void SetScreenHeight(int height){m_ScreenHeight = height;}
	void SetBrightness(int brightness) {m_nBrightness = brightness;}
	void SetFullScreen(bool full) {m_bFullScreen = full;}
	void SetDirect3D(CSGD_Direct3D* pD3D) {m_pD3D = pD3D;}
	void SetTextureManager(CSGD_TextureManager* pTM) {m_pTM = pTM;}
	void SetFMOD(CSGD_FModManager* pFM) {m_pFM = pFM;}
	void SetDirectInput(CSGD_DirectInput* pDI) {m_pDI = pDI;}
	void SetGameStates(vector<IGameState*> gameStates) {m_pGameState = gameStates;}
	void SetCurrentState(IGameState* gameState) {m_pCurrState = gameState;}
	void SetSFXVolume(float vol) {m_fSfxVol = vol;}
	void SetBGMVolume(float vol) {m_fBGM = vol;}
	void SetPanning(float pan) {m_fPan = pan;}
	void SetElapsedTime(float time) {m_fElapsedTime = time;}
	void SetGamePad(bool gamePad) {m_bGamePad = gamePad;}
	//void SetLevel(CLevel* level) {m_pCurrentLevel = level;}
	void SetScore(int score) {m_nScore = score;}
	RECT GetScreenRect(){return m_RenderRect;}
};

#endif